<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="../../css/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" href="../../css/allBase.css">
    <link rel="stylesheet" href="../../css/dialog.css" />
    <link href="../../js/riqi/bootstrap.min.css" rel="stylesheet">
    <link href="../../js/riqi/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" media="all" href="../../js/riqi/daterangepicker-bs3.css" />
    <style>
        #nrdvMsgBox{
			z-index: 99999;
		}
		#nrShowBolightBox{
			z-index: 9999;
		}
	    .selectionL{
	    	float: none;
	    }
	    .dataScale{
	    	width: 98%;
	    	height: auto;
	    	overflow: hidden;
	    	margin: 0 auto;
	    }
	    .dataScale>div:first-child{
	    	width: 49%;
	    	height: 80px;
	    	float: left;
	    	border: 1px solid #D2D6DE;
	    	box-shadow: 2px 2px 20px 2px #ddd;
	    }
	    .dataScale>div:last-child{
	    	width: 49%;
	    	height: 80px;
	    	float: left;
	    	border: 1px solid #D2D6DE;
	    	box-shadow: 2px 2px 20px 2px #ddd;
	    	margin-left: 2%;
	    }
	    .dataScale>div>h5{
	    	margin:15px 10px 5px;
	    	font-size: 25px;
	    }
	    .dataScale>div>h5>span{
	    	color: red;
	    }
    </style>
    <![endif]-->
    <title>结果</title>
</head>
<body>
	<div class="classifiedBox">
	     <div class="classified-search">
             <form class="form-horizontal" style="margin-bottom: 5px;">
                 <fieldset>
                  <div class="control-group">
                    <div class="controls">
                    <p style="float: left;line-height: 34px;">日期范围：</p>
                     <div class="input-prepend input-group" style="float: left;width:150px ;">
                     
                     	<span class="add-on input-group-addon">
                     		<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
                     	</span>
                     	<input type="text" readonly style="width: 200px" name="reservation" id="reservation" class="form-control" value="2017-7-21 - 2017-7-21" /> 
                   </div>
                     <p class="meici" style="float:left;color:red;line-height: 34px;">（每次最多选取60天）</p>
                    </div>
                  </div>
                 </fieldset>
              </form>
	        <div class="product-classification nohidden">
		        <div class="productR">产品分类：</div>
		        <div class="productL">
	                <ul class="productOne">
	                	<div>
	                		<p>请选择产品</p>
	                		<img src="../../img/spread.png">
	                	</div>
	                	<li>
	                		<span id="888">新版考试宝典</span>
	                	    <span id="8001">医学高级</span>
	                	    <span id="8002">主治医师</span>
	                	    <span id="8003">主治中医</span>
	                	    <span id="8004">护理考试</span>
	                	    <span id="8005">住院医师</span>
	                	    <span id="8006">执业医师</span>
	                	    <span id="8007">医技考试</span>
	                	    <span id="8008">药学职称</span>
	                	    <span id="8009">执业药师</span>
	                	   	<span id="8010">医学</span>
	                	    <span id="8011">内科主治医师</span>
	                	    <span id="8012">内科高级职称</span>
	                	    <span id="8013">外科主治医师</span>
	                	    <span id="8014">外科高级职称</span>
	                	    <span id="8015">主管护师</span>
	                	    <span id="8016">初级护师</span>
	                	    <span id="8017">医学中级职称</span>
	                	    <span id="8018">护理高级职称</span>
	                	    <span id="8019">技师(士)初级</span>
	                	    <span id="8020">技师中级职称</span>
	                	    <span id="8021">技师高级职称</span>
	                	</li>
	                </ul>
	                <p>—</p>
	                <ul class="productTwo">
	                	<div>
	                		<p>请选择科目</p>
	                		<img src="../../img/spread.png">
	                	</div>
	                	<li>
	              
	                	</li>
	                </ul>
	                <p class="three" style="display: none;">—</p>
	                <ul class="productThree" style="display: none;">
	                	<div>
	                		<p>--</p>
	                		<img src="../../img/spread.png">
	                	</div>
	                	<li>
	              
	                	</li>
	                </ul>
	                <p class="four" style="display: none;">—</p>
	                <ul class="productFour" style="display: none;">
	                	<div>
	                		<p>--</p>
	                		<img src="../../img/spread.png">
	                	</div>
	                	<li>
	                       
	                	</li>
	                </ul>
	            </div>
		    </div>
	        <button id="btncx" onclick="" class="btn btn-success" type="submit">开始查询</button>
	        <!--<div class="refresh">
	            <img src="../../img/refresh.png" alt="">
	            <a class="tabReload" href="#">刷新当前</a>
	        </div>-->
	    </div>
    </div>
    <!--数据展示结果-->
    <img class="loadingimg" src="../../img/loading.gif" style="position: absolute; top: 0%; left: 0; right: 0; bottom: 0; margin: auto;display: none;" />
    <div class="dataScale" style="display: none;">
    	<div>
    		<h5>游客分享历年真题成功的比例：<span>80%</span></h5>
    		<P>（计算公式：游客分享历年真题成功的比例=所有游客分享成功的次数/所有游客点击“分享”的次数）</P>
    	</div>
    	<div>
    		<h5>注册用户分享历年真题成功的比例：<span>80%</span></h5>
    		<P>（计算公式：注册用户分享历年真题成功的比例=所有注册用户分享成功的次数/所有注册用户点击“分享”的次数）</P>
    	</div>
    </div>
    <div class="panel-body" style="display: none;">
    	<div class="titleNum"></div>
    	<div class="title" style="width:100%">
    		<ul class="title1" >
    			<li class="list1">分享历年真题的数据对比图</li>
    			<li id="main1" class="main">
    			</li>
    		</ul>
    		<ul class="title2" >
    			<li class="list1">分享历年真题的数据趋势图</li>
    			
    			<li id="main" class="main">
    				
    			</li>
    		</ul>
    	</div>
        
    </div>
    
    <script src="../../js/jquery/jQuery-2.2.0.min.js"></script>
    <!--<script src="../js/charts/Chart.js"></script>-->
    <script type="text/javascript" src="../../js/base/echarts.common.min.js"></script>
    <script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../js/base/ajax.js"></script>
    <script type="text/javascript" src="../../js/base/yingSoftPrg.js"></script>
    <script type="text/javascript" src="../../js/base/dialog.js"></script>
    <script type="text/javascript" src="../../js/riqi/bootstrap.min.js"></script>
    <script type="text/javascript" src="../../js/riqi/moment.js"></script>
    <script type="text/javascript" src="../../js/riqi/daterangepicker.js"></script>

    <script type="text/javascript">
    	    var myDate = new Date();//添加日期
               	y=myDate.getFullYear(); 
               	m=myDate.getMonth()+1;
               	d=myDate.getDate()-1;
               	if(myDate.getDate()==1){
               		 d=myDate.getDate();
               	}
               	dqy=y+"-"+m+"-"+d;
               	$('#reservation').val(dqy+" - "+dqy)
               $(document).ready(function() {
                  $('#reservation').daterangepicker({
                        // startDate: moment().startOf('day'),  
                        //endDate: moment(),  
                        //minDate: '01/01/2012',    //最小时间  
                        maxDate : moment(), //最大时间   
                        dateLimit : {  
                            days : 60  
                        }, //起止时间的最大间隔  
                        showDropdowns : true,  
                        showWeekNumbers : false, //是否显示第几周  
                        timePicker : false, //是否显示小时和分钟  
                        timePickerIncrement : 60, //时间的增量，单位为分钟  
                        timePicker12Hour : false, //是否使用12小时制来显示时间  
                        ranges : {  
                            //'最近1小时': [moment().subtract('hours',1), moment()],  
                            '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
                            '最近7日': [moment().subtract('days', 6), moment()],
                            '最近30日': [moment().subtract('days', 29), moment()],  
                            '最近60日': [moment().subtract('days', 59), moment()]  
                        },  
                        opens : 'right', //日期选择框的弹出位置  
                        buttonClasses : [ 'btn btn-default' ],  
                        applyClass : 'btn-small btn-primary blue',  
                        cancelClass : 'btn-small',  
                        format : 'YYYY-MM-DD', //控件中from和to 显示的日期格式  
                        separator : ' - ',  
                        locale : {  
                            applyLabel : '确定',  
                            cancelLabel : '取消',  
                            fromLabel : '从',  
                            toLabel : '到',  
                            weekLabel: 'W',
                            customRangeLabel : '选择时间',  
                            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],  
                            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',  
                                    '七月', '八月', '九月', '十月', '十一月', '十二月' ]
//                          firstDay : 1  
                        }  
                    }, function(start, end, label) {//格式化日期显示框  
                        $('#reservation span').html(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));  
                    }); 
					
               });
               $(document).on('click','.applyBtn',function(){//判断日期是否是在60天之内
               	     var val=$('#reservation').val().split(' - ');
                  	 var endTime=new Date(val[1]);
                  	 var startTime=new Date(val[0]);
                  	if(endTime - startTime>5270400000){
                  		$('.daterangepicker').css('display','block')
                  		 G_Prg.alert('每次最多选取60天',function(){
		
	                    });
                  	}
               })
            var clients = [];
            var clientsName = [];
			var hTimes = ["0点","1点","2点","3点","4点","5点","6点","7点","8点","9点",
        				"10点","11点","12点","13点","14点","15点","16点","17点","18点","19点",
        				"20点","21点","22点","23点"
        				];
			var hwChart;
			var swChart;
			var times=[];//两个日期之间的区间
            this.init = function(){
                var option = {};
                var dd=new Date();
                var m=dd.getMonth()+1;
                var d1=dd.getDate();
                //var d2=dd.getDate();
                var days1=G_Prg.GetDay(dd.getFullYear(),m,d1);
                var days2=  dd.getFullYear()+'-'+m+'-'+d1;
                $('#logmin').val(days1);
                $('#logmax').val(days1);
                
                
                allclick();//点击事件
//              xlClick();//下拉点击

            }
            var selectArr={
                          "Arr1":[
                                {"appEname":"ZY_XY_YTMJ","name":"执业药师(西药)"},
                                {"appEname":"ZY_ZYAO_YTMJ","name":"执业药师(中药)"}
                          ],
                          "Arr2":[
                                {"appEname":"ZY_GW_ZL","name":"公卫执业助理医师"},
                                {"appEname":"ZY_GWZY_YTMJ","name":"公卫执业医师"},
                                {"appEname":"ZY_KQZL_YTMJ","name":"口腔执业助理医师"},
                                {"appEname":"ZY_KQZY_YTMJ","name":"口腔执业医师"},
                                {"appEname":"ZY_LCZL_YTMJ","name":"临床执业助理医师"},
                                {"appEname":"ZY_LCZY_YTMJ","name":"临床执业医师"},
                                {"appEname":"ZY_ZXYZL_YTMJ","name":"中西医结合执业助理医师"},
                                {"appEname":"ZY_ZXYZY_YTMJ","name":"中西医结合执业医师"},
                                {"appEname":"ZY_ZYZL_YTMJ","name":"中医执业助理医师"},
                                {"appEname":"ZY_ZYZY_YTMJ","name":"中医执业医师"}
                          ]           
            }
$('.productOne div').on('click',function(event){
        	    var liHeight=$('.productOne li span').length*34+'px';
        	    event.stopPropagation();
        		if($('.productOne li').css('height')=='1px'||$('.productOne li').css('height')=='0px'){
        			$('.productOne li').css({'border':'1px solid #e0e0e0','border-top':'none','height':liHeight});
        			$('.productOne div img').attr('src','../../img/packUp.png');
        			if($('.productOne li span').length>=6){
	    		      $('.productOne li').css({'overflow-y':'scroll','height':6*34+'px'})
	    			}
        		}else{
        		    $('.productOne li').css({'height':'0px','border':'1px solid #fff','border-top':'none'});
        		    $('.productOne div img').attr('src','../../img/spread.png');
        		}
        	})
        	$('.productOne li span').on('click',function(event){
        		event.stopPropagation();
        		$('.productOne div p').attr('id',$(this).attr('id'));
        	    $('.productOne div p').html($(this).html());
        	    $('.productOne li').css({'height':'0px','border':'1px solid #fff','border-top':'none'});
        		$('.productOne div img').attr('src','../../img/spread.png');
        		$('.productThree,.three,.four,.productFour').css({'display':'none'})
        		$('.productTwo div p').html('--');
        		//第一层的目录列表选择
        	    removeSession();//清除session 
        		switch($('.productOne div p').html()){
					case '医学高级':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8001));//传送数据
						break;
					case '主治医师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8002));//传送数据
						break;
					case '主治中医':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8003));//传送数据
						break;
					case '护理考试':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8004));//传送数据
						break;
					case '住院医师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8005));//传送数据
						break;
					case '执业医师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8006));//传送数据
						break;
					case '医技考试':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8007));//传送数据
						break;
					case '药学职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8008));//传送数据
						break;
					case '执业药师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8009));//传送数据
						break;
					case '新版考试宝典':
						$('.productTwo li').empty();
						addData(_getAppMenuData(888));//传送数据
						break;
					case '医学':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8010));//传送数据
						break;
					case '内科主治医师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8011));//传送数据
						break;
					case '内科高级职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8012));//传送数据
						break;	
					case '外科主治医师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8013));//传送数据
						break;
					case '外科高级职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8014));//传送数据
						break;
					case '主管护师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8015));//传送数据
						break;
					case '初级护师':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8016));//传送数据
						break;
					case '医学中级职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8017));//传送数据
						break;
					case '护理高级职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8018));//传送数据
						break;
					case '技师(士)初级':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8019));//传送数据
						break;
					case '技师中级职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8020));//传送数据
						break;
					case '技师高级职称':
						$('.productTwo li').empty();
						addData(_getAppMenuData(8021));//传送数据
						break;
			    }
        	})
			//3.2科目分层选择
	        $(document).on('click','.productTwo div',function(event){
	    		event.stopPropagation();
	    	    zhang(this);
	    	})
	        //3.3目录列表
	        $(document).on('click','.productThree div',function(event){
	    		event.stopPropagation();
	    	    zhang(this);
	    	})
	        //4.4最后一层目录列表
	        $(document).on('click','.productFour div',function(event){
	    		event.stopPropagation();
	    	    zhang(this);
	    	})
	        $(document).on('click','.productTwo li span',function(event){
	    		event.stopPropagation();
			    xuanze(this);
		    })  
	        $(document).on('click','.productThree li span',function(event){
	    		event.stopPropagation();
			    xuanze(this);
	    	})
	         $(document).on('click','.productFour li span',function(event){
	    		event.stopPropagation();
			    xuanze(this);
	    	})
	      
        function removeSession(){
	            sessionStorage.removeItem('8001_AppMenuData');
            	sessionStorage.removeItem('8002_AppMenuData');
            	sessionStorage.removeItem('8003_AppMenuData');
            	sessionStorage.removeItem('8004_AppMenuData');
            	sessionStorage.removeItem('8005_AppMenuData');
            	sessionStorage.removeItem('8006_AppMenuData');
            	sessionStorage.removeItem('8007_AppMenuData');
            	sessionStorage.removeItem('8008_AppMenuData');
            	sessionStorage.removeItem('8009_AppMenuData');
            	sessionStorage.removeItem('8010_AppMenuData');
            	sessionStorage.removeItem('8011_AppMenuData');
            	sessionStorage.removeItem('8012_AppMenuData');
            	sessionStorage.removeItem('8013_AppMenuData');
            	sessionStorage.removeItem('8014_AppMenuData');
            	sessionStorage.removeItem('8015_AppMenuData');
            	sessionStorage.removeItem('8016_AppMenuData');
            	sessionStorage.removeItem('8017_AppMenuData');
            	sessionStorage.removeItem('8018_AppMenuData');
            	sessionStorage.removeItem('8019_AppMenuData');
            	sessionStorage.removeItem('8020_AppMenuData');
            	sessionStorage.removeItem('8021_AppMenuData');
            	sessionStorage.removeItem('AppMenuData');
        }
        //第二层的目录列表
        function addData(menuData){
        	var menuChild = menuData.Childs;
        	console.log(menuChild)
        	if(menuChild.length <= 1 && $('.productOne p').html() != '住院医师'){
        	    var menuChild = menuChild[0].Childs;
        	}
        	var ulist ='';
        	for(var i=0;i<menuChild.length;i++){
        		if($('.productOne p').html() == '住院医师'){
        		  var lastMenu =menuChild[0].Childs;  
                  for(var j=0;j<lastMenu.length;j++){
			    	ulist = '<span appEName="'+lastMenu[j].AppEName+'" id='+j+'>'+lastMenu[j].Name+'</span>';
			    	$('.productTwo li').append(ulist);
			      }	
			      if(menuData){menuClick(menuChild)}	
			      console.log(menuChild)
			      return;
        		}
	        	if(menuChild.length <= 1){
	        	  var lastMenu =menuChild[0].Childs;  
                  for(var j=0;j<lastMenu.length;j++){
			    	ulist = '<span appEName="'+lastMenu[j].AppEName+'" id='+null+'>'+lastMenu[j].Name+'</span>';
			    	$('.productTwo li').append(ulist);
			      }	
			    }else{
			    	$('.productTwo div p').html(menuChild[0].Name);
			    	ulist = '<span appEName="'+menuChild[i].AppEName+'" id="'+i+'">'+menuChild[i].Name+'</span>';
			    	$('.productTwo li').append(ulist);
			    }
			    if(menuData){menuClick(menuChild)}	
        	}
        	$('.productTwo div p').html('--');
        }  	
        //第三层列表展示
        function menuClick(menuChild){
        	$('.productTwo li span').unbind('click').click(function(event){   
        		var curIndex = $(this).attr('id');
        		$('.productThree li').empty();	
        		if($('.productOne p').html() == '住院医师'){
        		  var lastMenu2 =menuChild[0].Childs[curIndex].Childs;  
                  for(var j=0;j<lastMenu2.length;j++){
			    	ulist = '<span appEName="'+lastMenu2[j].AppEName+'" id='+j+'>'+lastMenu2[j].Name+'</span>';
			    	$('.productThree li').append(ulist);
			      }	
			      $('.three').css('display','block');
			      $('.productThree').css('display','block');
        		}else{
        			var lastMenu = menuChild[curIndex].Childs;
	        		for(var i=0;i<lastMenu.length;i++){
	        			$('.productThree div p').attr('id',lastMenu[0].AppEName);
	        			$('.productThree div p').html(lastMenu[0].Name);
				    	ulist = '<span appEName="'+lastMenu[i].AppEName+'" id="'+i+'">'+lastMenu[i].Name+'</span>';
				    	$('.three').css('display','block');
				    	$('.productThree').css('display','block');
				    	$('.productThree li').append(ulist);
	        		}
	        		if(lastMenu){
	        			menuClick2(menuChild[curIndex].Childs)
	        		}
        		}  
        		event.stopPropagation();
			    $('.productTwo div p').html($(this).html());
			    $('.productTwo div p').attr('id',$(this).attr('id'));
			    $('.productTwo li').css({'height':'0px','border':'1px solid #fff','border-top':'none'});
				$('.productTwo div img').attr('src','../../img/spread.png');
        		$('.four,.productFour').css({'display':'none'})
        	    $('.productThree div p').html('--');
        	})
        }
        //第四层列表展示
        function menuClick2(menuChilds){
        	$('.productThree li span').unbind('click').click(function(event){
        		var curIndex = $(this).attr('id');
        		var lastMenu =menuChilds[curIndex].Childs;
        		$('.productFour li').empty();
        		if(menuChilds[curIndex].Childs != null){
	        		for(var i=0;i<lastMenu.length;i++){
	        			$('.productFour div p').attr('id',lastMenu[0].AppEName);
	        			$('.productFour div p').html(lastMenu[0].Name);
				    	ulist = '<span appEName="'+lastMenu[i].AppEName+'">'+lastMenu[i].Name+'</span>';
				    	$('.four').css('display','block');
				    	$('.productFour').css('display','block');
				    	$('.productFour li').append(ulist);
	        		}
	        		event.stopPropagation();
				    $('.productThree div p').html($(this).html());
				    $('.productThree div p').attr('id',$(this).attr('id'));
				    $('.productThree li').css({'height':'0px','border':'1px solid #fff','border-top':'none'});
					$('.productThree div img').attr('src','../../img/spread.png');		
        	        $('.productFour div p').html('--');
        		}
        		
        	})
        }
        //展开
	        function zhang(data){
	        	var liHeight=$(data).parent().find('li').find('span').length*34+'px';
	            if($(data).parent().find('li').css('height')=='1px'||$(data).parent().find('li')=='0px'){
	    			$(data).parent().find('li').css({'border':'1px solid #e0e0e0','border-top':'none','height':liHeight});
	    			$(data).parent().find('img').attr('src','../../img/packUp.png');
	    			if($(data).parent().find('li').find('span').length>=6){
	    		      $(data).parent().find('li').css({'overflow-y':'scroll','height':6*34+'px'})
	    			}
	    		}else{
	    		    $(data).parent().find('li').css({'height':'0px','border':'1px solid #fff','border-top':'none'});
	    		    $(data).parent().find('img').attr('src','../../img/spread.png');
	    		}
	        }
	        //选择
	       	function xuanze(data){
		    	$(data).parents('ul').find('p').html($(data).html());
			    $(data).parents('ul').find('p').attr('id',$(data).attr('id'));
			    $(data).parents('ul').find('li').css({'height':'0px','border':'1px solid #fff','border-top':'none'});
				$(data).parents('ul').find('img').attr('src','../../img/spread.png');
				$(data).parents('ul').find('p').attr('appEName',$(data).attr('appEName'));
		    }
            /**************************************************
             * 功能：点击事件
             * 函数名：allclick（）
             * 传入参数：无
             * 创建人：刘淳昊 2017-03-13
             *************************************************/
            function allclick() {
                //刷新页面
                $('.refresh').on('click',function(){
                    window.location.reload();
                })
                //切换科目选项 (全选反选)
                 $('.selectionL span').on('click',function(){//功能选择
                	$('.selectionL span').removeClass('selected');
                       $(this).addClass('selected')
                })
                $('.singleApp span').on('click',function(){
                	$('#allsingleproducts').removeClass('selected');
                	if($(this).hasClass('selected')){
                        $(this).removeClass('selected');
                    }else{
                        
                        $(this).addClass('selected');
                    }
                })
                
                //切换情况选项
                $('.purchase-situation span').on('click',function(){
                    if($(this).hasClass('selected')){
                        $(this).removeClass('selected');
                    }else{
                        $(this).addClass('selected').siblings().removeClass('selected');
                    }
                })
                var CCappEName = '';//选择appename
                //查询结果
                $('#btncx').on('click',function(){
                var val=$('#reservation').val().split(' - ');
                var startTime=new Date(val[0]);
                var endTime=new Date(val[1]);
                if(endTime-startTime<5270400000){
                    $('.loadingimg').show();
                	$('.panel-body,.dataScale').hide();
                	if($('.productFour').css('display') == 'block' && $('.productFour div>p').html() != '--'){
	        	         CCappEName = $('.productFour div > p').attr('appEName');
	        	         console.log(CCappEName)
			        }else if($('.productThree').css('display') == 'block' && $('.productThree div>p').html() != '--' && $('.productFour').css('display') == 'none'){
			        	 CCappEName = $('.productThree div > p').attr('appEName');
			        	 console.log(CCappEName)
			        }else if($('.productTwo').css('display') == 'block' && $('.productTwo div>p').html() != '--' && $('.productThree').css('display') == 'none'){
			        	 CCappEName = $('.productTwo div > p').attr('appEName');
			        	 console.log(CCappEName)
			        }else{
			        		alert("请选择科目")
	                   }
                	setTimeout(function(){
                		$('.panel-body,.dataScale').show();
	                    getLoginData();
//	                    getLoginCount();
	                    window.onresize = function () {
					        hwChart.resize();
					        swChart.resize();
					    }
                	},500)
                }else{
               		G_Prg.alert('每次最多选取60天',function(){
		
	                });
                }
                })
				
            }

            /**************************************************
             * 功能：数据绘图
             * 函数名：Canvas1（）
             * 传入参数：无
             * 创建人：刘淳昊 2017-03-30
             *************************************************/
            function Canvas1(jsonData,times,clientsName){
//          	console.log(jsonData)
                var series =[];
                var xAxis =[];
                var btn=[];
                var zhuData=[];
//              for(var i =0;i<jsonData.length;i++){
//              	if(jsonData[i].btnName.substring(1,jsonData[i].btnName.length) != '考前突击'){
//              			btn.push(jsonData[i].btnName.substring(1,jsonData[i].btnName.length));
//              			zhuData.push(jsonData[i].data);
//              	}
//          	
//          	}
                for(var i =0;i<jsonData.length;i++){
                        btn.push(jsonData[i].btnName);
                		zhuData.push(jsonData[i].data);
            	
            	}
//              $('.titleNum').append('全部产品总登录人数：'+_total);
                var StyleSin = function(){
                    return {
                        data:[],
                        axisLabel: {
							show: true,
							textStyle: {
								color: '#000',
								fontFamily: "microsoft yahei",
								fontSize: 12
							}
						}
                    }
                };
                var Item = function(){
                    return {
                        name:'',
                        type:'line',
                        itemStyle: {normal: {}},
                        label: {normal: {}},
                        data:[]
                    }
                };
                
				//x轴分为两种情况 （1.0-23小时  2.时间日期 xxxx-xx-xx）
                for(var i =0;i<zhuData.length;i++){
                    if(times.length>1){
                        var it = new Item();
                        var style = new StyleSin();
//                      btn.push(jsonData[i].btnName);
                        it.name = btn[i];
                        it.type = 'line';
                        it.data = zhuData[i].split(',');
                        style.data = times;
                        style.type = 'category';
                        style.boundaryGap = false;
                        style.name='(时间)';
                        series.push(it);// 将item放在series中
                        xAxis.push(style);
                        console.log(jsonData[i].data.split(','));
                    }
                    if(times.length == 1 ){
                        var it = new Item();
                        var style = new StyleSin();
//                      btn.push(jsonData[i].btnName);
                        it.name = btn[i];
                        it.type = 'line';
                        it.data = zhuData[i].split(',');
                        style.data = hTimes;
                        style.type = 'category';
                        style.boundaryGap = false;
                        style.name='(时间)';
                        series.push(it);// 将Itemsin放在series中
                        xAxis.push(style);// 将StyleSin放在xAxis中
                        
                    }
                

                }
//              console.log(series[0].name)
                // 基于准备好的dom，初始化echarts实例
                 swChart = echarts.init(document.getElementById('main'));
				
                // 指定图表的配置项和数据
                option = {
                    title: {
                    	x:'20',
                        text: ''
                    },
                    tooltip:{
                        trigger: 'axis'
                    },
                    legend:{
                        data:btn
                    },
                     grid: {
				        left: '2%',
				        bottom: '0%',
				        containLabel: true
				    },
                    yAxis: {
                        type : 'value'
                    },
                    series: []
                };
                option.series = series;
          
                option.xAxis = [{  //修改上面的日期
             	   axisLabel:{show:true},
	               textStyle:{color:"#000",fontFamily:"microsoft yahei",fontSize:12},
	               boundaryGap:false,
	               name:"(时间)",
	               type:"category",
                   data:xAxis[0].data
              }];
                // 使用刚指定的配置项和数据显示图表。
                swChart.setOption(option);
            }
             
             
             /**************************************************
             * 功能：数据绘图(饼状图)
             * 函数名：Canvas2（）
             * 传入参数：无
             * 创建人：刘淳昊 2017-03-30
             *************************************************/
            function Canvas2(jsonData,clientsName){
               var btn=[];
               var zhuData=[];
            	for(var i =0;i<jsonData.length;i++){
                       	btn.push(jsonData[i].btnName);
            			zhuData.push(jsonData[i].count);
            	}
               hwChart = echarts.init(document.getElementById('main1'));
				var app = {};
				var option = null;
				app.title = '坐标轴刻度与标签对齐';
				 
				option = {
				    color: ['#3398DB'],
				    tooltip : {
				        trigger: 'axis',
				        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
				            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
				        }
				    },
				    legend: {
			             data:['访问量']
			        },
				    grid: {
				        left: '3%',
				        right: '4%',
				        bottom: '3%',
				        containLabel: true
				    },
				    xAxis : [
				        {
				            type : 'category',
				            data : btn,
				            axisTick: {
				                alignWithLabel: true
				            }
				        }
				    ],
				    yAxis : [
				        {
				            type : 'value'
				        }
				    ],
				    series : [
				        {
				            name:["访问量"],
				            type:'bar',
				            barWidth: '60%',
				            data:zhuData,
				            itemStyle: {
				                normal: {
				                    color: function(params) {
				                        // build a color map as your need.
				                        var colorList = [
				                          '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
				                           '#FE8463','#9BCA63'
				                        ];
				                        return colorList[params.dataIndex]
				                    }
				                }
				            },
				            label:{ 
				                normal:{ 
				                    show: true, 
				                    position: 'top'
				                    }
				            }
				        }
				    ]
				};
				 
				if (option && typeof option === "object") {
				    hwChart.setOption(option, true);
            }
           }
            
            /**************************************************
             * 功能：登录成功人数数据 /api/new/loginCount
             * 接口：https://tongji.ksbao.com:8003
             * 函数名：getLoginData（）
             * 传入参数：startDay    开始时间
             *         endDay      结束时间
             *         clients     所选单品
             *         userType    购买未购买[0未购买、1购买、2合计]
             * 创建人：刘淳昊 2017-03-20
             *************************************************/
            function getLoginData(){
                var val=$('#reservation').val().split(' - ');
                var startTime = val[0];
                var endTime = val[1];
                clients=[];
                
                $('.productL .selected').each(function(){
                	clients.push($(this).attr('id'));
                });
                $('.singleApp .selected').each(function(){
                	clients.push($(this).attr('id'));
					
                });
                
                getAll(startTime,endTime);
                var userType = $('.purchase-situation .selected').attr('id');
                var client = $('.productOne div p').attr('id');
                var dataType = $('.selectionL .selected').attr('name');
                var appEName=$('.productTwo div p').attr('id');
                var clientsData = JSON.stringify(clients);
                var clientsNameData = JSON.stringify(clientsName);
                var _url='/api/new/harassLine?startDay='+startTime+'&endDay='+endTime+'&location='+'历年真题'+'&appEName='+'ZY_ZYAO' +'&dataType='+1;
                G_AjaxApi_test.get(_url,false,function(json){
                var jsonData = JSON.parse(json);
                    if(jsonData.status ==200){
                        if(jsonData.data ==[ ]){
                            alert('数据为空');
                        }else{
                        	$('.titleNum').empty();
                            var _data = jsonData.data;
                            var _data2 = jsonData.data.trend;
//                          var _total = jsonData.data.allcount;
                            $('.loadingimg').hide();
                            Canvas1(_data,times,appEName);
//   						Canvas2(_data,clientsName);
                        }

                    }else {
                        console.log(jsonData.status)
                    }
                })
                var _url2='/api/new/harassColumn?startDay='+startTime+'&endDay='+endTime+'&location='+'历年真题'+'&appEName='+'ZY_ZYAO' +'&dataType='+1;
                G_AjaxApi_test.get(_url2,false,function(json){
                var jsonData = JSON.parse(json);
                    if(jsonData.status ==200){
                        if(jsonData.data ==[ ]){
                            alert('数据为空');
                        }else{
                        	$('.titleNum').empty();
                            var _data = jsonData.data;
                            var _data2 = jsonData.data.trend;
//                          var _total = jsonData.data.allcount;
                            $('.loadingimg').hide();
//                          Canvas1(_data,times,appEName);
     						Canvas2(_data,clientsName);
                        }

                    }else {
                        console.log(jsonData.status)
                    }
                })
                var _url3='/api/new/harassRatio';
                G_AjaxApi_test.get(_url3,false,function(json){
                var jsonData = JSON.parse(json);
                    if(jsonData.status ==200){
                        if(jsonData.data ==[ ]){
                            alert('数据为空');
                        }else{
                        	$('.titleNum').empty();
                            var _data = jsonData.data;
                            var _data2 = jsonData.data.trend;
//                          var _total = jsonData.data.allcount;
                            $('.loadingimg').hide();
//                          Canvas1(_data,times,appEName);
//   						Canvas2(_data,clientsName)
                            $('.dataScale div:nth-child(1) span').html(_data.tourist+'%');
                            $('.dataScale div:nth-child(2) span').html(_data.user+'%');
                        }

                    }else {
                        console.log(jsonData.status)
                    }
                })
            }
            
            /**********************************************************
            * 功能：获取日期区间
            * ********************************************************/
            Date.prototype.format=function (){
			    var s='';
			    s+=this.getFullYear()+'-';          // 获取年份。
			    s+=(this.getMonth()+1)+"-";         // 获取月份。
			    s+= this.getDate();                 // 获取日。
			    return(s);                          // 返回日期。
			};
			function getAll(begin,end){
				times=[];
			    var ab = begin.split("-");
			    var ae = end.split("-");
			    var db = new Date();
			    db.setUTCFullYear(ab[0], ab[1]-1, ab[2]);
			    var de = new Date();
			    de.setUTCFullYear(ae[0], ae[1]-1, ae[2]);
			    var unixDb=db.getTime();
			    var unixDe=de.getTime();
			    for(var k=unixDb;k<=unixDe;){
				    times.push((new Date(parseInt(k))).format());
				    k=k+24*60*60*1000;
			    }
			}

            init();


    </script>
</body>
</html>